package com.wuze.cloud.dao;

import com.wuze.cloud.model.SysUploadData;
import com.wuze.cloud.pojo.SysFileDO;
import com.wuze.cloud.request.SysAdminFileQuery;
import com.wuze.cloud.request.SysFilePreCheckQuery;
import com.wuze.cloud.request.SysFileQuery;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Set;

/**
 * @author: wuze
 * @description:
 * @date: 2023/02/20
 */
@Repository
public interface SysFileDao {

    List<SysFileDO> findByFolderIds(@Param("folderIds")List<Long> folderIds , @Param("userId") Long userId , @Param("state") String state);
    SysFileDO findById(@Param("id") Long id,@Param("userId") Long userId, @Param("state") String state);
    SysFileDO findOne(@Param("query") SysFilePreCheckQuery query, @Param("state") String state);
    List<SysFileDO> findByFolderIdsAdmin(@Param("folderIds")List<Long> folderIds,@Param("state") String state);
    SysFileDO findByKey(@Param("openKey") String openKey);

    List<SysFileDO> findByIds(@Param("ids") Set<Long> ids , @Param("state") String state);

    List<SysFileDO> findByPage(@Param("query")SysFileQuery query,
                               @Param("state") String state,
                               @Param("type") String type);

    Integer countByUserId(@Param("userId") Long userId,
                          @Param("folderIds") List<Long> folderIds,
                          @Param("state") String state ,
                          @Param("fileName") String fileName,
                          @Param("type") String type);
    Integer countByAdmin(@Param("userIds") List<Long> userIds,
                         @Param("state") String state ,
                         @Param("fileName") String fileName,
                         @Param("type") String type);

    List<SysFileDO> findPageByAdmin(@Param("userIds") List<Long> userIds,
                            @Param("state") String state ,
                            @Param("fileName") String fileName,
                            @Param("type") String type,
                            @Param("query")SysAdminFileQuery query);

    List<SysUploadData> getUploadData(@Param("userId") Long userId);


    void save(@Param("file") SysFileDO file);

    void batchUpdateFileState(@Param("ids") Set<Long> ids,@Param("state") String state);

    void updateFile(@Param("file") SysFileDO file);

    void batchRestoreOrDel(@Param("ids") Set<Long> ids,
                           @Param("rootId") Long rootId,
                           @Param("uuid") String uuid);

}
